package org.qloudgen.borg.pages.frame;


import org.apache.wicket.Page;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler;
import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.util.io.IClusterable;

public final class FrameTarget implements IClusterable
{
    private static final long serialVersionUID = 1L;

    private Class<? extends Page> frameClass;

    public <C extends Page> FrameTarget(Class<C> frameClass)
    {
        this.frameClass = frameClass;
    }

    public Class<? extends Page> getFrameClass()
    {
        return frameClass;
    }

    public <C extends Page> void setFrameClass(Class<C> frameClass)
    {
        this.frameClass = frameClass;
    }

    public CharSequence getUrl()
    {
        return RequestCycle.get().urlFor(
            new BookmarkablePageRequestHandler(new PageProvider(frameClass)));
    }
}
